﻿using System.Web.Mvc;
using LeanBoard.Models;

namespace LeanBoard.Controllers
{
    public class LeanBoardController : Controller
    {
        private IDataProvider _dataProvider = new InMemoryDataProvider();

        public ActionResult Index(string team, string release)
        {
            var itemsCollection = _dataProvider.GetItems(team, release);

            return View(itemsCollection);
        }

        [HttpPost]
        public JsonResult Move(Item item)
        {
            DominoActionResult result = _dataProvider.MoveItem(item);
            return Json(result);
        }

        [HttpPost]
        public JsonResult Assign(string itemUnid, string name)
        {
            DominoActionResult result = _dataProvider.Assign(itemUnid, name);
            return Json(result);
        }
    }
}
